ToggleControl : BaseControl{


	baseSetValue{ 
		arg theValue;
		value = theValue;		
		
			("ToggleControl.baseSetValue  \SyncRecord. value = " + theValue).postln;

	}

	
	
	getGuiClass{
		^ToggleControlView;
	}

	
} 

ToggleControlView : BaseControlView{

	var button;
	
	subInit{
		button = SCButton.new(container, Rect(0, 10, 120, 20))
			.states_([
			[name.asString + "On" ,Color.grey,Color.white],
			[name.asString + "Off" ,Color.white,Color.red]
				
			])
			.canFocus_(false);
	}
	
	createContainer{
		container = SCCompositeView.new(parentContainer, 380@30);
		container.relativeOrigin_(true);}
		
		
				
	createActions{|target|
		button.action_({|button| target.setControlValue(name, button.value)});	
	}
	
	createControlMapEntries{|map|
		map.put(name, ControlValueSetter(button));	
	}

		
}
